package com.googlecode.payroll

class WorkingHoursTotalizer {

    private static final int WORKING_HOURS = 0
    private static final int EMPLOYEE_ID = 1

    def workingHoursOf(empId) {

        // FIXME Having trouble when array size is 0
        try {
            size()
        } catch (MissingMethodException e) {
            return 0
        }

        for ( record in this) {
            if (empId == record[EMPLOYEE_ID]) {
                return record[WORKING_HOURS]
            }
        }
        0
    }
}
